home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(_currentframe != 8)
- {
- if(yspeed == (- _root.air.bar._xscale) / 4)
- {
- falling = true;
- }
- _Y = _Y + yspeed;
- yspeed += grav;
- _X = _X + xspeed;
- xspeed *= 0.91;
- xspeed += 0.8;
- cx += (_X - cx) / 5;
- _root._x = Stage.width / 2 - cx;
- cy += (_Y - cy + 25) / 5;
- _root._y = Stage.height / 2 - cy;
- _root.hud._x = cx;
- _root.hud._y = cy - 30;
- _root.wide._x = cx;
- _root.wide._y = cy;
- _root.light._x = cx;
- _root.light._y = cy;
- _root.bg._x = cx - 268;
- _root.bg._y = cy - 150;
- _root.air._x = cx + 275;
- _root.air._y = cy - 125;
- _root.hud._x = cx;
- _root.hud._y = cy;
- if(_root.land.hitTest(_X,_Y + h,true))
- {
- yspeed = 0;
- grounded = true;
- falling = false;
- doubleJump = false;
- if(_currentframe == 2)
- {
- gotoAndStop(3);
- }
- if(_currentframe == 7)
- {
- gotoAndStop(3);
- }
- if(_currentframe == 6)
- {
- gotoAndStop(3);
- }
- if(_currentframe == 4)
- {
- gotoAndStop(3);
- }
- if(_currentframe != 3 && _currentframe != 5)
- {
- gotoAndStop(1);
- }
- while(_root.land.hitTest(_X,_Y + h,true))
- {
- _Y = _Y - 0.1;
- }
- }
- if(Key.isDown(39))
- {
- _X = _X + 3;
- }
- if(Key.isDown(37))
- {
- _X = _X - 3;
- }
- if(Key.isDown(32) && grounded && !holding && _currentframe != 5)
- {
- holding = true;
- gotoAndStop(5);
- }
- if(Key.isDown(32) && holding == true)
- {
- _root.air.bar._xscale += 5;
- }
- if(!Key.isDown(32) && holding)
- {
- yspeed = (- _root.air.bar._xscale) / 4;
- gotoAndStop(2);
- grounded = false;
- holding = false;
- }
- if(Key.isDown(32) && !grounded && doubleJump != true && !falling)
- {
- yspeed = -13;
- gotoAndStop(1);
- gotoAndStop(2);
- doubleJump = true;
- }
- if(yspeed <= -15)
- {
- yspeed = -15;
- }
- var nmbr = 0;
- xval = 0;
- yval = 0;
- i = 1;
- while(i < seg)
- {
- var tx = _X + r * Math.sin(i * (360 / seg) * 0.017453292519943295);
- var ty = _Y - r * Math.cos(i * (360 / seg) * 0.017453292519943295);
- if(_root.land.hitTest(tx,ty,true))
- {
- nmbr++;
- xval += tx;
- yval += ty;
- }
- i++;
- }
- if(nmbr > 0 && _xscale > 0)
- {
- _rotation = Math.atan2(_X - xval / nmbr,_Y - yval / nmbr) / 0.017453292519943295 * -1 - 180;
- }
- if(fall == true)
- {
- _Y = dy;
- _X = dx;
- fall = false;
- }
- if(fall)
- {
- _root.blink.play();
- }
- if(Key.isDown(65) && !grounded && this.tailgrab._currentframe >= 7 && this.tailgrab._currentframe <= 11 && _currentframe != 6 && _currentframe != 7)
- {
- this.gotoAndStop(4);
- holdA = true;
- _root.score += 10;
- }
- if(Key.isDown(65) && _currentframe == 6)
- {
- if(this.spin._currentframe >= 20)
- {
- this.gotoAndStop(4);
- }
- holdA = true;
- _root.score += 10;
- }
- if(Key.isDown(65) && _currentframe == 7)
- {
- if(this.indie._currentframe >= 16)
- {
- this.gotoAndStop(4);
- }
- holdA = true;
- _root.score += 10;
- }
- if(Key.isDown(83) && !grounded && _currentframe != 4 && _currentframe != 7)
- {
- this.gotoAndStop(6);
- Shold = true;
- _root.score += 10;
- }
- if(Key.isDown(83) && _currentframe == 4)
- {
- if(this.tailgrab._currentframe >= 7)
- {
- this.gotoAndStop(6);
- }
- Shold = true;
- _root.score += 10;
- }
- if(Key.isDown(83) && _currentframe == 7)
- {
- if(this.indie._currentframe >= 16)
- {
- this.gotoAndStop(6);
- }
- Shold = true;
- _root.score += 10;
- }
- if(Key.isDown(68) && !grounded && _currentframe != 4 && _currentframe != 6)
- {
- this.gotoAndStop(7);
- Dhold = true;
- _root.score += 10;
- }
- if(Key.isDown(68) && _currentframe == 6)
- {
- if(this.spin._currentframe >= 20)
- {
- this.gotoAndStop(7);
- }
- Dhold = true;
- _root.score += 10;
- }
- if(Key.isDown(68) && _currentframe == 4)
- {
- if(this.tailgrab._currentframe >= 7)
- {
- this.gotoAndStop(7);
- }
- Dhold = true;
- _root.score += 10;
- }
- if(!grounded)
- {
- if(!Key.isDown(65))
- {
- holdA = false;
- }
- if(!Key.isDown(83))
- {
- Shold = false;
- }
- if(!Key.isDown(68))
- {
- Dhold = false;
- }
- }
- }
- if(_root.hud.lives <= 0)
- {
- this.gotoAndStop(8);
- }
- _root.fadeIn._x = cx;
- _root.fadeIn._y = cy;
- }
-